from socket import socket, AF_INET, SOCK_DGRAM
import pygame
data = 'mb'
port = 9930
hostname = '192.168.1.230'

screen = pygame.display.set_mode((640, 480))

pygame.init()

udp = socket(AF_INET,SOCK_DGRAM)


while 1:

    for event in pygame.event.get():


	if event.type == pygame.KEYDOWN:
		if event.key == pygame.K_UP:
			udp.sendto("mf", (hostname, port))
			print "mf"
		if event.key == pygame.K_DOWN:
			udp.sendto("mb", (hostname, port))
			print "mb"
		if event.key == pygame.K_LEFT:
			udp.sendto("tl", (hostname, port))
			print "tl"
		if event.key == pygame.K_RIGHT:
			udp.sendto("tr", (hostname, port))
			print "tr"
		if event.key == pygame.K_w:
			udp.sendto("hu", (hostname, port))
			print "hu"
		if event.key == pygame.K_s:
			udp.sendto("hd", (hostname, port))
			print "hd"
		if event.key == pygame.K_a:
			udp.sendto("hl", (hostname, port))
			print "hl"
		if event.key == pygame.K_d:
			udp.sendto("hr", (hostname, port))
			print "hr"
		if event.key == pygame.K_SPACE:
			udp.sendto("stop", (hostname, port))
			print "stop"
		if event.key == pygame.K_q:
			print "quit"
			exit();
